package com.jwds.digital.bios.business.core.infrastructure.dto.basic.assembler;

import com.jwds.digital.bios.business.core.infrastructure.dto.basic.BasicOperateLogReqDTO;
import com.jwds.digital.bios.business.core.infrastructure.dto.belt.BeltAnomalyInfoReqDTO;
import com.jwds.digital.bios.business.core.infrastructure.entity.basic.BasicOperateLog;
import com.jwds.digital.bios.business.core.infrastructure.entity.belt.BeltAnomalyInfo;
import com.jwds.digital.bios.business.core.infrastructure.vo.basic.BasicOperateLogRespVO;
import com.jwds.digital.bios.business.core.infrastructure.vo.belt.BeltAnomalyInfoRespVO;

import java.util.Objects;

/**
 * @Description BeltAnomalyInfoAssembler1
 * @Author xiao  xun
 * @Date 2024-12-09
 */
public class BasicOperateLogAssembler {
    public static BasicOperateLog dto2entity(BasicOperateLogReqDTO dto)  {
        if (dto == null) {
            return null;
        }
        BasicOperateLog entity = new BasicOperateLog();
        entity.setOperType(dto.getOperType());
        entity.setOperMenu(dto.getOperMenu());
        entity.setOperDetail(dto.getOperDetail());
        entity.setState(dto.getState());
        entity.setDescription(dto.getDescription());
        entity.setOperGroup(dto.getOperGroup());
        entity.setRequestUrl(dto.getRequestUrl());
        entity.setRequestParam(dto.getRequestParam());
        entity.setResponseParam(dto.getResponseParam());
        return entity;
    }


    public static BasicOperateLog dto2entity(BasicOperateLogReqDTO dto, BasicOperateLog entity){
        if (dto == null) {
            return null;
        }
        if(Objects.nonNull(dto.getOperType())) {
            entity.setOperType(dto.getOperType());
        }
        if(Objects.nonNull(dto.getOperMenu())) {
            entity.setOperMenu(dto.getOperMenu());
        }
        if(Objects.nonNull(dto.getOperDetail())) {
            entity.setOperDetail(dto.getOperDetail());
        }
        if(Objects.nonNull(dto.getState())) {
            entity.setState(dto.getState());
        }
        if(Objects.nonNull(dto.getDescription())) {
            entity.setDescription(dto.getDescription());
        }
        if(Objects.nonNull(dto.getOperGroup())) {
            entity.setOperGroup(dto.getOperGroup());
        }
        if(Objects.nonNull(dto.getRequestUrl())) {
            entity.setRequestUrl(dto.getRequestUrl());
        }
        if(Objects.nonNull(dto.getRequestParam())) {
            entity.setRequestParam(dto.getRequestParam());
        }
        if(Objects.nonNull(dto.getResponseParam())) {
            entity.setResponseParam(dto.getResponseParam());
        }
        return entity;
    }

    public static BasicOperateLogRespVO entity2dto(BasicOperateLog entity) {
        if (entity == null) {
            return null;
        }
        BasicOperateLogRespVO dto = new BasicOperateLogRespVO();
        dto.setId(entity.getId());
        dto.setOperType(entity.getOperType());
        dto.setOperMenu(entity.getOperMenu());
        dto.setOperDetail(entity.getOperDetail());
        dto.setState(entity.getState());
        dto.setDescription(entity.getDescription());
        dto.setOperGroup(entity.getOperGroup());
        dto.setRequestUrl(entity.getRequestUrl());
        dto.setRequestParam(entity.getRequestParam());
        dto.setResponseParam(entity.getResponseParam());
        return dto;
    }
}
